Changing Decoder trait to be more composable. (#938)#1008
Conversation
|
Got 2 questions:
|
This one is not breaking
Yes. |
|
The documentation is not available anymore as the PR was closed or merged. |
| fn decode(&self, tokens: Vec<String>) -> Result<String>; | ||
| fn decode(&self, tokens: Vec<String>) -> Result<String> { | ||
| let results = self.decode_chain(tokens)?; | ||
| Ok(results.join("")) |
There was a problem hiding this comment.
will this line cause any problem for the SequenceDecoder?
Specifically, one unlikekly edge-case I'm thinking is: one of the sequence decoders is another sequence decoder, and Ok(results.join("")) will cause an informaition loss (vec of str now just becomes a str)?
as a solution, we can implement fn decode for Sequence Decoder?
There was a problem hiding this comment.
It's OK I think.
The parent Sequence would call the child Sequence.decode_chain NOT the decode function, so we're good, no ?
I could add a test to make sure.
There was a problem hiding this comment.
ooh I see, so it is no problem in that case
Decodertrait to be more composable.